package com.huatai.vba.service;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.huatai.vba.dal.jdbc.DBUtils;

@Service
public class SaveFileDAO {

	public List<Map> queryList() {
		List list = new ArrayList();
		Connection conn = null;
		PreparedStatement pstm = null;
		ResultSet rs = null;
		try {
			conn = null;
			String sql = "select b.vc_fund_code, b.vc_fund_name, a.vc_seat_id "
					+ " from ttradeseat a, tfundinfo b where a.l_fund_id = b.l_fund_id"
					+ "  and a.c_market_no = '1' and a.c_trade = '1' order by b.vc_fund_code asc";
			pstm = conn.prepareStatement(sql);
			rs = pstm.executeQuery();
			System.out.println();
			while (rs.next()) {
				Map map = new HashMap();
				map.put("vc_fund_code", rs.getString("vc_fund_code"));
				map.put("vc_fund_name", rs.getString("vc_fund_name"));
				map.put("vc_seat_id", rs.getString("vc_seat_id"));
				list.add(map);
			}
			System.out.println("++++++++++++++" + list.size() + "++++++++++++");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			DBUtils.close(rs);
			DBUtils.close(pstm);
			DBUtils.close(conn);
		}
		return list;
	}

}
